package com.zjc.test;/*
 *
 *作者：张继成
 *任务：
 *
 *备注：
 *@Date2023/06/19/9:24
 ***/


import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import com.utils.ValidateCodeUtils;
public class sendMsg {
    public static void main(String[] args) {
        String s = ValidateCodeUtils.generateValidateCode4String(4);
        DefaultProfile profile=DefaultProfile.getProfile(
                "ch-hangzhou",
                "LTAI5tCB94gzN4jr44pijKX1",
                "rB5ygOecXfUTMshcAzeQBmSNBFwhNN");
        IAcsClient client=new DefaultAcsClient(profile);
        SendSmsRequest request = new SendSmsRequest();
        request.setSysRegionId("cn-hangzhou");
        request.setPhoneNumbers("18578034273");
        request.setSignName("岸上见考研互助平台");
        request.setTemplateCode("SMS_461305808");
        System.out.println(s);
        request.setTemplateParam("{\"code\":\""+s+"\"}");
        try {
            SendSmsResponse response = client.getAcsResponse(request);
            System.out.println("短信发送成功");
        }catch (ClientException e) {
            e.printStackTrace();
        }
    }

}
